<!--login.html -->
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8" />
    <title>登录 - MQTT Broker</title>
    <!-- 引入全局样式 -->
    <link rel="stylesheet" href="css/login.css" />
</head>
<body>
<div class="login-container">
    <h2>MQTT Broker 登录</h2>
    <form id="loginForm">
        <label>
            <input type="text" id="username" required />
        </label><br/>
        <label>
            <input type="password" id="password" required />
        </label><br/>
        <button type="submit">登录</button>
    </form>
</div>

<script type="module">
    import { login } from './js/auth.js';

    document.getElementById('loginForm').addEventListener('submit', async (e) => {
        e.preventDefault();
        const username = document.getElementById('username').value;
        const password = document.getElementById('password').value;
        await login(username, password);
    });
</script>
</body>
</html>
